<!-- Faraday Penetration Test IDE -->
<!-- Copyright (C) 2013  Infobyte LLC (http://www.infobytesec.com/) -->
<!-- See the file 'doc/LICENSE' for the license information -->

<form novalidate>
    <div class="modal-header">
        <div class="modal-button btn-toolbar">
            <button class="btn btn-success" ng-click="okEdit()" ng-disabled="form.$invalid || date.$invalid">OK</button>
            <button class="btn btn-danger" ng-click="cancel()">Cancel</button>
        </div>
        <h3 class="modal-title">Edit Workspace: {{workspace.name}}</h3>
    </div>
    <div class="modal-body">
        <div class="form-horizontal">
            <div class="form-group" ng-class="{'has-error': form.name.$invalid }">
                <div class="col-md-12">
                    <ng-form name="form" novalidate>
                        <label class="sr-only" for="wsp-name">Workspace Name</label>
                        <input type="text" class="form-control"
                                           ng-pattern=/^[a-z0-9][a-z0-9\_\$\(\)\+\-\/]*$/ id="vuln-name" name="name" placeholder="Workspace Name"
                                                                              ng-model="workspace.name" required/>
                        <div ng-if="form.$invalid">
                            <div class="alert alert-danger target_not_selected" role="alert" ng-hide="">
                                <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
                                <span class="sr-only">Error:</span>
                                <button type="button" class="close" data-dismiss="alert"><span area-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                                Workspace name should follow pattern [a-z0-9][a-z0-9_$()+-/]*
                            </div>
                        </div>
                    </ng-form>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-12">
                    <label class="sr-only" for="vuln-desc">Workspace Description</label>
                    <textarea class="form-control" id="vuln-desc"
                                                   placeholder="Description" value={{workspace.description}}
                        ng-model="workspace.description"></textarea>
                </div>
            </div><!-- .form-group -->
            <div class="form-group">
                <div class="col-md-6 datepicker">
                    <h5>Start Date</h5>
                    <label class="sr-only" for="work-start">Start Date</label>
                    <p class="input-group">
                      <input type="text" class="form-control" uib-datepicker-popup="MM/dd/yyyy" ng-model="workspace.duration.start_date" is-open="openedStart" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" close-text="Close" placeholder="Start Date"/>
                      <span class="input-group-btn">
                        <button type="button" class="btn btn-default" ng-click="open($event,true)"><i class="glyphicon glyphicon-calendar"></i></button>
                      </span>
                    </p>
                </div>
                <div class="col-md-6 datepicker">
                    <h5>End Date</h5>
                    <label class="sr-only" for="work-end">End Date</label>
                    <p class="input-group">
                      <input type="text" class="form-control" uib-datepicker-popup="MM/dd/yyyy" ng-model="workspace.duration.end_date" is-open="openedEnd" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" close-text="Close" placeholder="End Date"/>
                      <span class="input-group-btn">
                        <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                      </span>
                    </p>
                </div>

            </div>
            <div class="form-group">
                <div class="col-md-12">
                    <h5>Scope</h5>
                    <span class="input-group-addon button-radius" ng-click="newScope($event)">Add scope target</span>
                </div>
                <div class="col-md-12 input-margin" ng-repeat="scope in workspace.scope">
                    <div class="input-group margin-bottom-sm col-md-12">
                        <input type="text" class="form-control" placeholder="Scope target" ng-model="scope.key"/>
                        <span class="input-group-addon" ng-click="workspace.scope.splice($index, 1)" ng-hide="workspace.scope.length == 1"><i class="fa fa-minus-circle"></i></span>
                    </div>
                </div>
            </div><!-- .form-group -->
        </div><!-- .form-horizontal -->
    </div><!-- .modal-body -->
</form>
